<template>
    <div class='dialog'>
        <div class='newAdd dialog-con depotContentName'>
            <div class="companynews">
                <h2 >更新仓库名称</h2>
            </div>
            <div class='depotEdit'>
                <label><span>*</span>仓库编码</label><el-input type="text" placeholder="必输项"    v-model="addinfo.depotCode"></el-input><br>
                <label><span>*</span>仓库名称</label><el-input type="text" placeholder="必输项"   v-model="addinfo.depotName" ></el-input><br>
                <label><span>*</span>仓库地址</label><el-input type="text" placeholder="必输项"  v-model="addinfo.depotAddress"></el-input><br>
                <label><span>*</span>类别</label><el-input type="text" placeholder="必输项"     :value="addinfo.depotType | depotType" disabled></el-input><br>
                <label><span>*</span>仓库负责人</label><el-input type="text" placeholder="必输项" v-model="addinfo.depotPerson"></el-input><br>
                <label><span>*</span>负责人电话</label><el-input type="text" placeholder="必输项" v-model="addinfo.depotPhone"></el-input><br>
                <label><span>*</span>结款方式</label><el-input type="text" placeholder="必输项" v-model="addinfo.payType" disabled></el-input><br>
            </div>
            <div class="confirm">
                <el-button @click="confirm" type="primary" style="margin-right:20px;" size="medium">确定</el-button>
                <el-button @click="cancel" size="medium">取消</el-button>
            </div>
        </div>
    </div>
</template>
<script>
import regular from 'js/regular'
export default {
    inject:['reload'],
    data(){
        return{ 
           
        }
    },
    props:{
        addinfo:{
            type:Object,
            default:{}
        }
    },
    created(){
        this.addinfo.payType="按月结"
    },
    filters:{
        depotType(val){
            return val == "1" ? "本地仓库" :"委外仓库"
        }
    },
    methods:{
        cancel(){
            this.$emit('closeDialog')
        },
       confirm(){
            let parmas={
                depotCode:this.addinfo.depotCode,
                depotName:this.addinfo.depotName,
                depotAddress:this.addinfo.depotAddress,
                depotType:this.addinfo.depotType,
                depotPerson:this.addinfo.depotPerson,
                depotPhone:this.addinfo.depotPhone,
                payType:this.addinfo.payType,
                id:this.addinfo.id
            }
            let success=data=>{
                if(data.code=='OK'){
                    this.$message.success('保存成功')
                    this.$emit('closeDialog')
                    this.reload()
                }else{
                    this.$message.error(data.msg)
                }
            }
           this.api.depotUpdate(parmas,success)
        },
       
       
    }
}
</script>
<style lang="scss" scoped>
    .depotContentName{
        width:500px;
        height:500px;
        .companynews{
            h2{
                height:45px;
                line-height: 45px;
                font-size: 18px;
                text-align: center;
                background: #eee;
                color: #606266;
            }
        }
        .depotEdit{
            margin-left:2%;
            label{
                width: 100px;
                display: inline-block;
                color:#606266;
                font-size:14px;
            }
            .el-input{
                height:40px;
                margin:8px 0;
                width:300px;
                font-size:14px;
                color:#606266;
            }
            span{
                color:red;
            }
            p{
                margin-left:115px;
                font-size:12px;
                color:red;
            }
        }
        .deposit{
            margin-left: 12%;
            label{
            margin-right:30px; 
            }
        }
        .confirm{
            margin-left:35%;
            margin-top:2%;
        }
        .baseinfo{
            font-size: 16px;
            line-height: 35px;
            margin-left:20px;
        }
    }

</style>
